<%@page pageEncoding = "utf-8" contentType = "text/html;charset=utf-8"%>

<%@taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix = "fmt" uri = "http://java.sun.com/jsp/jstl/fmt"%>

<h2><fmt:message key = "form.addeditEmployee"/></h2>

<div class = "messages"><jsp:include page = "/messages.jsp"/></div>


<form action = "adminui" method = "post" name = "employeeAddForm">
<div id="box">
   <table class = "form">      
   	  <tr>
         <td class = "label"><fmt:message key = "form.login"/><span class="star">*</span></td>
         <td>
         	 <input name = "login" type = "text" maxlength="10" value = '<c:out value = "${employeeBean.login}"/>'>
           <span class="error"><c:out value="${error.login}"/></span>
         </td>
      </tr>
      
      <tr>
         <td class = "label"><fmt:message key = "form.password"/><span class="star">*</span></td>
         <td>
         	 <input name = "password" type = "password" maxlength="10" value = '<c:out value = "${employeeBean.password}"/>'>
           <span class="error"><c:out value="${error.password}"/></span>
         </td>
      </tr>
      
      <tr>
         <td class = "label"><fmt:message key = "form.repassword"/><span class="star">*</span></td>
         <td>
         	 <input name = "repassword" type = "password" maxlength="10" value = '<c:out value = "${employeeBean.rePassword}"/>'>
           <span class="error"><c:out value="${error.rePassword}"/></span>
         	</td>
      </tr>      
      
      <tr>
         <td class = "label"><fmt:message key = "employee.lastName"/><span class="star">*</span></td>
         <td>
         	 <input name = "lastName" type = "text" maxlength="50" value = '<c:out value = "${employeeBean.lastName}"/>'>
           <span class="error"><c:out value="${error.lastName}"/></span>
         </td>
      </tr>
      
      <tr>
         <td class = "label"><fmt:message key = "employee.firstName"/><span class="star">*</span></td>
         <td>
         	 <input name = "firstName" type = "text" maxlength="50" value = '<c:out value = "${employeeBean.firstName}"/>'>
           <span class="error"><c:out value="${error.firstName}"/></span>
         </td>
      </tr>
      
      <tr>
         <td class = "label"><fmt:message key = "employee.middleName"/><span class="star">*</span></td>
         <td>
         	  <input name = "middleName" type = "text" maxlength="50" value = '<c:out value = "${employeeBean.middleName}"/>'>
            <span class="error"><c:out value="${error.middleName}"/></span>
         </td>
      </tr>  
      
      <tr>
         <td class = "label"><fmt:message key = "employee.email"/><span class="star">*</span></td>
         <td>
         	 <input name = "email" type = "text" maxlength="50" value = '<c:out value = "${employeeBean.email}"/>'>
           <span class="error"><c:out value="${error.email}"/></span>
         </td>
      </tr>                
      
      <tr>
         <td class = "label"><fmt:message key = "employee.type"/><span class="star">*</span></td>
         <td>
            <select name="type_id">
              <c:forEach var = "type" items = "${typesList}">
                <option value="${type.id}" ${type.id == employeeBean.typeId ? "selected" : ""}>${type.name}</option>
              </c:forEach>
            </select>            
            <span class="error"><c:out value="${error.type}"/></span>
         </td>
      </tr>                 
      
      <tr>
         <td class = "label"><fmt:message key = "employee.group"/><span class="star">*</span></td>
         <td>
            <select name="group_id">
              <c:forEach var = "group" items = "${groupsList}">
                <option value="${group.id}" ${group.id == employeeBean.groupId ? "selected" : ""}>${group.name}</option>
              </c:forEach>
            </select>            
            <span class="error"><c:out value="${error.group}"/></span>
         </td>
      </tr>                  
</table>

</div>

<p>
   <span class="small">Обязательные для заполнения поля отмечены</span><span class="star">*</span>
</p>
	
<input name = "id" type = "hidden" value='<c:out value = "${employeeBean.id}"/>'>   
<input name = "_action" type = "hidden" value="processEmployeeForm">      

<p>
  <input type="submit" value='<fmt:message key = "Command.save"/>'>
  или
  <a href = "adminui?_action=employessList"><fmt:message key = "Command.cancel"/></a>         
</p>

</form>